package userApi

import (
	"chart.zozoo.net/app/service/userService"
	"chart.zozoo.net/app/utils/rsp"
	"github.com/gin-gonic/gin"
)

func Register(c *gin.Context) {
	p := &userService.RegisterParams{}
	if err := c.ShouldBindJSON(p); err != nil {
		rsp.JsonErr(c, rsp.SetMsg(err.Error()))
		return
	}
	id, err := p.Register()
	if err != nil {
		rsp.JsonErr(c, rsp.SetMsg(err.Error()))
		return
	}

	rsp.JsonOk(c, rsp.SetData(id))
}
